//领取课程二维码
 $(".lingqu").click(function(){
	 $(".erweima").slideToggle();
 });


//课程详情AJAX
var id = window.location.search;
console.log(id)
var lid=parseInt(id.split('=')[1]) ;
console.log(lid)
$.get(`/index/detail?lid=${lid}`,data=>{
	console.log(data)
	const {course_brief:brief,
	course_title:title,
	course_hourse:h,
	course_studyNumber:n,
	course_image:img,
	course_id:id} = data[0];
	$('.title>h1').text(title)
	$('.title>p>span:nth-child(1)').text("时长:"+h+'小时')
	$('.title>p>span:nth-child(2)').text(n+'人在学')
	$('.course_introduce>p:nth-child(2)').text(brief)
	$('.body_rigth_header').text()
	html=`<img src="${img}" >`
	$(".body_rigth_header").append(html)
	const html1=`<a href="video_course.html?lid=${id}">开始学习</a>`
	$('#kaishixuexi').append(html1);
	// const html_one = data.map(value => {
	// 	    return `
	// 			<div>
	// 			<a href="course_detail.html?lid=${id}">
	// 			   	<img src="${i}" >
	// 			   	<div id="">								
	// 			   	<p>${t}</p>
	// 			   	<p>学习周期：${h}小时</p>	
	// 			   	</div>
	// 			</a>
	// 			</div>
	// 	        `;
	// 	     });
	// 	$(".f3_body").append(html_one);
})


//讲师介绍ajax请求
$.get(`/index/teacher?lid=${lid}`,data=>{
	console.log(data)
	const {tutor_describes:describes,tutor_name:name} = data[0];
	$('.teacher_introduce>p:nth-child(2)').text(describes)
	$('.teacher_introduce>p:nth-child(1)>span').text(name)
})
